-- villager
-- created by panyl
-- 地牢格子：村民

return {
    restoreGrid = function(grid, info)
        grid.took = info.took;
    end,

    -- 收集上下文
    collectContext = function(grid)
        return { ["took"] = grid.took, };
    end,

    autoFight = function(grid)
        local pos = grid:getPos();
        if VillagerM.canTakeBonus(pos) then
            -- 村民领奖
            return DungeonActionM.go("villager_bonus", pos);
        elseif grid.took and VillagerM.canArm(pos) then
            -- 武装
            return DungeonActionM.go("arm_villager", pos);
        end
        return false;
    end,
};
